package cn.tedu.luban.city.controller;

import cn.tedu.luban.city.builder.CitiesBuilder;
import cn.tedu.luban.city.vo.CityVO;
import cn.tedu.luban.city.vo.CodeVO;
import com.tedu.inn.protocol.model.Result;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CityController {
    @GetMapping("/city/tree")
    @ApiOperation(value = "返回三级城市树")
    public Result<List<CityVO>> cityTree() {
        return new Result<>(CitiesBuilder.buildCityTree());
    }
    @GetMapping("/code/tree")
    @ApiOperation(value = "获取编码和子编码")
    public Result<List<CodeVO>> codeTree() {
        return new Result<>(CitiesBuilder.getCodes());
    }
}
